package iblink.core;

import iblink.util.Constants.SecType;

public class Stock implements ISecurity {

	private static SecType SEC_TYPE = SecType.STOCK;

	protected String symbol;

	protected String longName;

	protected String industry;

	protected String category;

	protected String subCategory;

	protected String primaryExchange;

	public Stock(String symbol, String longName, String industry,
			String category, String subCategory, String primaryExchange) {
		this.symbol = symbol;
		this.longName = longName;
		this.industry = industry;
		this.category = category;
		this.subCategory = subCategory;
		this.primaryExchange = primaryExchange;
	}

	public String toString() {
		return getClass().getSimpleName() + "[symbol[" + symbol + "] longName["
				+ longName + "] industry[" + industry + "] category["
				+ category + "] subCategory[" + subCategory
				+ "] primaryExchange[" + primaryExchange + "]]";
	}

	public String getSymbol() {
		return symbol;
	}

	public String getLongName() {
		return longName;
	}

	public String getIndustry() {
		return industry;
	}

	public String getCategory() {
		return category;
	}

	public String getSubCategory() {
		return subCategory;
	}

	public String getPrimaryExchange() {
		return primaryExchange;
	}

	public SecType getSecType() {
		return SEC_TYPE;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((symbol == null) ? 0 : symbol.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Stock other = (Stock) obj;
		if (symbol == null) {
			if (other.symbol != null)
				return false;
		} else if (!symbol.equals(other.symbol))
			return false;
		return true;
	}
}